//
//  BTC.swift
//  XHWalletUtils
//
//  Created by xinph on 2020/5/16.
//  Copyright © 2020 xinph. All rights reserved.
//

import Foundation
@_exported import XHTokenCore
@_exported import CoreBitcoin

public class BTC: Wallet {
    public var mnemonicKeystore: BTCMnemonicKeystore?
    
    override public class func empty() -> WalletType {
        return BTC(path:CoinBIP44.defaultBTCPath, isHD: false, privateKey: nil, publicKey: nil)
    }
    
    override init(_ mnemonic: String? = nil, keystore: Data? = nil, path: String, isHD: Bool, privateKey: String?, publicKey: String?) {
        super.init(mnemonic, keystore: keystore, path: path, isHD: isHD, privateKey: privateKey, publicKey: publicKey)
        didLoad()
    }

    required init(from decoder: Decoder) throws {
        fatalError("init(from:) has not been implemented")
    }
    
    override public func didLoad() {
        Self.setCipher(password: zxbcmbaksd)
    }
}

extension XHTokenCore.Network {
    static func accessOnDiffrenceNetwork() -> XHTokenCore.Network{
        let network: XHTokenCore.Network
        switch Config.default.network {
        case .mainnet: network = .mainnet
        default:
            network = .testnet
        }
        return network
    }
}
